package com.project.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.project.bean.BuyerCarBean;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface IBuyerCarMapper extends BaseMapper<BuyerCarBean> {
    List<BuyerCarBean> findByUserId(Integer userId);

    @Select("SELECT * FROM t_buyerCar where fk_productId = #{productId} and fk_userId = #{userId}")
    @ResultMap("CarMap")
    BuyerCarBean findByProductId(@Param("productId") String productId,
                                       @Param("userId") Integer userId);
}
